package com.jwpdk.appframework.controller;

import com.jwpdk.appframework.cache.CacheFactory;
import com.jwpdk.common.Config;
import com.jwpdk.common.Constant;
import com.jwpdk.dbframework.Transaction;
import com.jwpdk.dbframework.TransactionManager;

/**
 * JWPDK配置信息初始化
 * @author 王志伟
 *
 */
public final class Jwpdk {

	public static void initialization () throws Exception{
		// 初始化配置文件
		Config.getInstance();
		Dispatcher dispatcher = Dispatcher.getInstance();
		Transaction transaction = new Transaction(Constant.FRAMEWOR_TRANSACTION);
		TransactionManager tManager = TransactionManager.getInstance();
		tManager.beginTransaction(transaction);
		// 初始化缓存
		CacheFactory.getInstance();
		// 初始化ACTION映射
		dispatcher.initialization();
		tManager.endTransaction(transaction);
	}
	public static void main(String[] args) {
		try {
			initialization();
		} catch ( Exception e ) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
